<?php
namespace app\app\controller\v1;
use think\Db;
class NewsController extends  BaseController{

    /**
     * @return array
     * 新闻类别
     */
    public function TypeList()
    {
        $data = Db::name('news_type')->where(['status'=>1])->select();
        return json_code('200','success',$data);
    }

    /**
     * 根据分类查看列表
     */
    public function NewsType()
    {
        $type_id = input('post.type_id');
        $data =Db::name('news')->where(['status'=>1,'tid'=>$type_id])->select();
        return json_code('200','success',$data);
    }

    /**
     * 详情
     */
    public function NewsDetail()
    {
        $id = input('post.id');
        $data = Db::name('news')->where('status','eq','1')->find($id);
        return json_code('200','success',$data);
    }



}